package com.uphone.magicleafteacher.pro.adapter;

import android.support.annotation.NonNull;

import com.blankj.utilcode.util.SizeUtils;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.uphone.magicleafteacher.R;
import com.uphone.magicleafteacher.pro.activity.CourseLiveWorkActivity;
import com.uphone.magicleafteacher.util.CommonUtil;
import com.uphone.magicleafteacher.view.MyBaseViewHolder;
import com.uphone.magicleafteacher.vo.TeacherLiveBean;

public class CoureAdapter extends BaseQuickAdapter<TeacherLiveBean.ClassListBean, MyBaseViewHolder> {
    public CoureAdapter() {
        super(R.layout.item_coure);
    }

    @Override
    protected void convert(@NonNull MyBaseViewHolder helper, TeacherLiveBean.ClassListBean item) {
        helper.addOnClickListener(R.id.by_buy_course);
        if (item.getLiveStatus() == 0) {
            helper.setText(R.id.by_buy_course,"查看作业")
                    .getView(R.id.other_courses_type).
                    setBackground(mContext.getResources().
                            getDrawable(R.drawable.item_other_curriculum_notstarted)
                    );
            helper.setText(R.id.other_courses_type, "未开始");
        } else if (item.getLiveStatus() == 1) {
            helper.setText(R.id.by_buy_course,"查看作业")
                    .getView(R.id.other_courses_type).
                    setBackground(mContext.getResources().
                            getDrawable(R.drawable.item_other_curriculum_begin));
            helper.setText(R.id.other_courses_type, "直播中");
        } else {
            helper.setText(R.id.by_buy_course,item.getLiveStatus()==3?"查看":"奖励积分")
                    .getView(R.id.other_courses_type).
                    setBackground(mContext.getResources().
                            getDrawable(R.drawable.item_other_curriculum_h));
            helper.setText(R.id.other_courses_type, "已结束");
        }

        helper.setText(R.id.text_course, item.getClassName());
        helper.setText(R.id.tv_time_start, item.getStartTime());
        helper.setText(R.id.tv_time_end, item.getEndTime());
        helper.setImageViewCorner(mContext, R.id.img_bg, CommonUtil.getImageUrl(item.getFacePic()), SizeUtils.dp2px(5));
    }


}
